import { Context } from 'egg';

const AuthMiddleware = () => {
  return async (ctx: Context, next) => {
    if (!ctx.isAuthenticated()) {
      ctx.body = { errcode: 401, message: '请登录' };
      return;
    }
    await next();
  };
};

export default AuthMiddleware;
